package cn.edu.swu.core;

import jakarta.servlet.http.HttpServlet;

public abstract class BasicServlet extends HttpServlet {

    protected String wrapPage(String pageContent) {
        StringBuilder sb = new StringBuilder();
        sb.append("<!DOC TYPE html>")
                .append("<html lang=\"en\">")
                .append("<head><meta charset=\"UTF-8\"><title>西大网上书店</title>")
                .append("<link rel=\"stylesheet\" href=\"../css/bookstore.css\">")
                .append("</head>")
                .append("<body>")
                .append("<div style=\"width:99%;background-color:#336699;color:#ffffff\"><marquee><h2>欢迎访问西南大学网上书店</h2></marquee></div>")
                .append("<center>")
                .append("<div class='menu'>")
                .append("<a href='./list' class='menu_item'>显示图书</a>")
                .append("<a href='../add_book.html' class='menu_item'>添加图书</a>")
                .append("<form action='./search' class='menu_form'><input type='text' name='key'><input type='submit' value='查询图书'></form>")
                .append("</div>")
                .append(pageContent)
                .append("</center>")
                .append("</body>")
                .append("</html>");
        return sb.toString();
    }


}
